"use strict";
const { Model } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
  class DailyMenu extends Model {
    /**
     * Helper method for defining associations.
     * This method is not a part of Sequelize lifecycle.
     * The `models/index` file will call this method automatically.
     */
    static associate(models) {
      // define association here
    }
  }
  DailyMenu.init(
    {
      menuTypeId: {
        type: DataTypes.INTEGER,
        allowNull: false,
        validate: {
          notNull: {
            msg: "缺少菜单类型",
          },
        },
      },
      date: {
        type: DataTypes.DATE,
        allowNull: false,
        validate: {
          notNull: {
            msg: "缺少日期",
          },
          notEmpty: {
            msg: "日期不能为空",
          },
        },
      },
    },
    {
      sequelize,
      modelName: "DailyMenu",
    }
  );
  return DailyMenu;
};
